Skip to content

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 7, 2026

Summary

Problem

PR #479 (sed portability) added source shared-constants.sh to 7 scripts. PR #480 (shared-constants adoption) independently added the same line to 155 scripts. When both merged, 5 scripts ended up with two source lines. Under set -euo pipefail, the second source fails on readonly re-declaration, causing all supervisor-helper.sh commands to silently exit 1 (batch, help, status, pulse — everything broken).

Root Cause

shared-constants.sh declares 81 readonly variables. Sourcing it twice triggers readonly variable errors. With set -e, this kills the script even when the second source has || true (bash propagates errors from within sourced files).

Fix

  1. Include guard in shared-constants.sh: [[ -n "${_SHARED_CONSTANTS_LOADED:-}" ]] && return 0 — makes it idempotent
  2. Remove duplicates from 5 scripts: supervisor-helper.sh, version-manager.sh, auto-version-bump.sh, unstract-helper.sh, agent-test-helper.sh

Testing

# Before fix: exits silently
supervisor-helper.sh help  # no output, exit 1

# After fix: works correctly
supervisor-helper.sh help  # shows usage, exit 0
supervisor-helper.sh batch "test" --tasks "t146"  # creates batch

Summary by CodeRabbit

  • Chores
    • Improved internal script initialization and dependency loading to enhance reliability and prevent duplicate source issues in development tooling.

…urce lines

PR #480 (shared-constants adoption) added source lines to scripts that
already had them from PR #479 (sed portability), causing double-sourcing.
Under set -euo pipefail, the second source fails on readonly re-declaration,
silently breaking supervisor-helper.sh (batch, help, all commands return 1).

Fix: Add include guard (_SHARED_CONSTANTS_LOADED) so shared-constants.sh
is safe to source multiple times. Also remove 5 duplicate source lines.
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

Walkthrough

The PR refactors shell script initialization in .agents/scripts/ by adding an include guard to shared-constants.sh, consolidating its sourcing to script startups, and replacing optional fallback patterns with explicit unconditional sourcing. This standardizes constant loading behavior and prevents duplicate definitions.

Changes

Cohort / File(s) Summary
Include Guard Addition
shared-constants.sh
Added _SHARED_CONSTANTS_LOADED flag to prevent multiple sourcing of the same file, returning early on subsequent loads to avoid re-definitions.
Sourcing Consolidation
agent-test-helper.sh, auto-version-bump.sh, unstract-helper.sh, version-manager.sh
Moved explicit sourcing of shared-constants.sh to script startup with descriptive comments; removed optional fallback patterns (2>/dev/null || true), making constant availability a strict requirement.
Redundant Source Removal
supervisor-helper.sh
Removed duplicate optional sourcing attempt; retained single explicit source statement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #254: Modifies .agents/scripts/version-manager.sh for repo-root detection and remote sync verification, overlapping with this PR's changes to the same file.
  • PR #447: Updates .agents/scripts/shared-constants.sh to add sed_inplace() helper function, directly intersecting with this PR's include guard modifications.

Poem

🔄 Constants consolidated, guard gates the flow,
No duplicates dancing where sourcing goes,
Scripts stand unified, errors now thrown,
Shell scripts pristine—A-grade, fully grown!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding an include guard to shared-constants.sh and removing duplicate source lines across multiple scripts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/duplicate-source

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 31 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 7 21:02:27 UTC 2026: Code review monitoring started
Sat Feb 7 21:02:28 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 31
Sat Feb 7 21:02:28 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sat Feb 7 21:02:30 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 31
  • VULNERABILITIES: 0

Generated on: Sat Feb 7 21:02:30 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2026

@marcusquinn marcusquinn merged commit 7c1e89f into main Feb 7, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant